import { BrowserWindow, ipcMain } from "electron";

let musicWindow;
const winURL =
	process.env.NODE_ENV === "development"
		? `http://localhost:9080`
		: `file://${__dirname}/index.html`;

const music = () => {
	musicWindow = new BrowserWindow({
		width: 400,
		height: 170,
		useContentSize: true,
		// 双击放大
		maximizable: false,
		// 背景透明
		transparent: true,
		// 是否可缩放
		resizable: false,
		// 是否去除外边框
		frame: false,
		// 是否置顶
		alwaysOnTop: true,
		//全屏展示
		// fullscreen: true,
		// 窗口居中
		center: true,
		webPreferences: {
			// 是否打开调试控制台
			devTools: false,
			enablemotemodule: true,
			nodeIntegration: true,
			// 不拦截跨域
			webSecurity: false,
		},
	});

	musicWindow.loadURL(winURL + "#/music");

	musicWindow.on("closed", () => {
		musicWindow = null;
	});
};

export default music;
